cmake_minimum_required(VERSION 3.10)

project(ped)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -Os -g")

aux_source_directory(./src SRC)

#include_directories
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../common/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../db/include)


#library_directories
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/lib)
# LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/src/common)
# LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/src/settings)
# LINK_DIRECTORIES(${CMAKE_BINARY_DIR}/src/db)


add_executable(${PROJECT_NAME} ${SRC}) # 生成可执行文件

#TARGET_LINK_LIBRARIES(pemd xxx.so)
TARGET_LINK_LIBRARIES(${PROJECT_NAME} libdb libEasyLogger)

add_custom_command(TARGET  ${PROJECT_NAME}
        POST_BUILD
        COMMAND echo "${PROJECT_NAME} builded finished."
        COMMAND ${CMAKE_COMPILER_STRIP} "$<TARGET_FILE:${PROJECT_NAME}>"
        COMMAND ${CMAKE_COMMAND} -E copy  $<TARGET_FILE:${PROJECT_NAME}> ${CMAKE_BINARY_PATH}/${PROJECT_NAME}
       )
      
#install(TARGETS pemd LIBRARY DESTINATION ${CMAKE_INSTALL_BINARY_DIR})